using System;
using System.Diagnostics;
using ZoneFiveSoftware.Common.Data;
using ZoneFiveSoftware.Common.Data.Fitness;
using FilteredStatistics.Controller;

namespace FilteredStatistics.Data
{
    class WholeActivityFilteredDataSet : IFilteredDataSet
    {
        private WholeActivityFilteredDataSet()
        {
        }

        public FilterResults GetFilteredTimes()
        {
            Debug.Assert(m_Activity != null);

            FilterResults result = new FilterResults();
            ActivityInfo activityInfo = ActivityInfoCache.Instance.GetInfo(m_Activity);

            result.Add(new ValueRange<DateTime>(activityInfo.ActualTrackStart, activityInfo.ActualTrackStart + activityInfo.ActualTrackTime));

            return result;
        }

        public static WholeActivityFilteredDataSet Instance
        {
            get
            {
                if (m_Instance == null)
                {
                    m_Instance = new WholeActivityFilteredDataSet();
                }

                return m_Instance;
            }
        }

        public IActivity Activity
        {
            set
            {
                m_Activity = value;
            }
        }

        private static WholeActivityFilteredDataSet m_Instance = null;
        private IActivity m_Activity = null;
    }
}
